package rgbos.forum.domain;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public abstract class ForumElement {

	private int id_;
	private String title_;
	private String authorName_;
	private Date creationDate_;
	protected  String DELIMITER ="~~~";
	DateFormat df;
	/**
	 * @param id_
	 * @param title_
	 * @param authorId_
	 * @param creationDate_
	 */
	public ForumElement(int id_, String title_, String authorName,
			Date creationDate_) {
		super();
		this.id_ = id_;
		this.title_ = title_;
		this.authorName_ = authorName;
		this.creationDate_ = creationDate_;
		df = new SimpleDateFormat("dd/MM/yyyy");
	}

	/**
	 * @return the id_
	 */
	public int getId_() {
		return id_;
	}

	/**
	 * @param id_ the id_ to set
	 */
	public void setId_(int id_) {
		this.id_ = id_;
	}

	/**
	 * @return the title_
	 */
	public String getTitle_() {
		return title_;
	}

	/**
	 * @param title_ the title_ to set
	 */
	public void setTitle_(String title_) {
		this.title_ = title_;
	}

	/**
	 * @return the authorId_
	 */
	public String getAuthorName() {
		return authorName_;
	}

	/**
	 * @param authorId_ the authorId_ to set
	 */
	public void setAuthorName(String authorName) {
		this.authorName_ = authorName;
	}

	/**
	 * @return the creationDate_
	 */
	public Date getCreationDate_() {
		return creationDate_;
	}

	/**
	 * @param creationDate_ the creationDate_ to set
	 */
	public void setCreationDate_(Date creationDate_) {
		this.creationDate_ = creationDate_;
	}
	public String getElementAsString(){
		return this.id_+DELIMITER+this.title_+DELIMITER+this.authorName_+DELIMITER+df.format(this.creationDate_)+DELIMITER;
	}

}
